class ClientController < ApplicationController
layout "office", :except => [:new, :edit] 
active_scaffold :clients do | config | 
config.list.columns = [:id, :client_group, :status, :firm_name,:first_name, :laat_name  ]
end
  
  #def index
   # list
    #render :action => 'list'
  #end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  #verify :method => :post, :only => [ :destroy, :create, :update ],
   #      :redirect_to => { :action => :list }

  #def list
   # @client_pages, @clients = paginate :clients, :per_page => 10
  #end

  #def show
  #  @client = Client.find(params[:id])
  #end

  
  def new
    @client = Client.new 
  end

  def create
    @client = Client.new(params[:client])
    if @client.save
      flash[:notice] = 'Client was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @client = Client.find(params[:id])
  end

  def update
    @client = Client.find(params[:id])
    if @client.update_attributes(params[:client])
      flash[:notice] = 'Client was successfully updated.'
      #redirect_to :action => 'show', :id => @client
      render :action => 'list' 
    else
      render :action => 'edit'
    end
  end

end
